/*
** Created by Gahon Alexis
*/

#ifndef NETWORKMANAGER_HH
#define NETWORKMANAGER_HH

#include <Header.hh>

struct	NetHeader
{
    unsigned char	_slotType;
    unsigned short	_packetId;
    unsigned short	_len;
};

struct  NetPacket
{
    NetHeader		_header;
    char		    data[255];
} __attribute__((packed));

/*struct tab {
  char		*key;
  int		value;
};*/


class NetworkManager
{
    public:
        NetworkManager(bool connected  = false);
        virtual ~NetworkManager();

        void    RunTCP();
        bool    TCPConnect();
        bool    TCPSend();
        bool    TCPReceive();
        bool    TCPDisconnect();


        void    RunUPD();
        void    UPDBind();
        void    UDPSend();
        void    UDPReceive();

    protected:
    private:
        bool            Connected;
        sf::IPAddress   ipClient;
        sf::IPAddress   ipServer;

        sf::SocketUDP   Socket;
        sf::SocketTCP   Listener;
};

#endif // NETWORKMANAGER_HH
